Replication Code and Data for field experimental results from "Competence versus Priorities: Negative Electoral Responsesto Education Quality in Brazil"
Authors: Taylor C. Boas, F. Daniel Hidalgo, Guillermo Toral
Contact email: dhidalgo@mit.edu.
Date: June 23, 2020

 The main replication file is "rct_code.R". 

All necessary data files are in the data subfolder. The file "lasso_covars.R" contains functions necessary to run the analysis code. To run the code, you must have the following subdirectories in the working directory: "data", "figures", and "tables". The code will generate tables and figures and save them in those directories. 


Code:
- rct_code.R.R: Main analysis file. 
- lasso_covars.R: Functions necessary for analysis.
- panel_data_cleaning_code.R: Cleans panel survey data for key analyses in the paper. 
- data_cleaning_functions.R: Functions used for cleaning survey data. 

Main Data for Key Results:
- panel_cleaned.csv: This is the main panel dataset used in the paper for the key analytic results. Created by "panel_data_cleaing_code.R"

Codebook:
- rct_codebook.pdf: Codebook for panel_cleaned.csv

Supplementary Data Files for auxiliary analyses and data cleaning:
- Banco Boston University (2577 casos).sav: Original endline data sent from survey firm. Source: the present research project.
- Banco de Dados - Projeto Boston University (3193 CASOS).sav: Original baseline data sent from survey firm. Source: the present research project.
- cand_merge_data.RData: Database of 2016 mayoral candidates and election outcomes in Pernambuco; these are merged into the survey data. Source: Brazil, Tribunal Superior Eleitoral, "Repositório de Dados Eleitorais," http://www.tse.jus.br/eleicoes/estatisticas/repositorio-de-dados-eleitorais-1/repositorio-de-dados-eleitorais.
- competitiveness_2012.csv: 2012 Mayor Vote Margin data used to construct moderator. Brazil, Tribunal Superior Eleitoral, "Repositório de Dados Eleitorais," http://www.tse.jus.br/eleicoes/estatisticas/repositorio-de-dados-eleitorais-1/repositorio-de-dados-eleitorais.
- data_questionnaire_panel_r2.csv: Treatment assignment and related data for endline survey data. Source: the present research project.
- data_questionnaire_panel.csv: Treatment assignment and related data for baseline survey data. Source: the present research project.
- data_rosettastone.RData: Contains municipality identifiers useful for merging datasets. Source: Cesar Zucco, http://www.fgv.br/professor/ebape/cesar.zucco/.
- panel_muni_sample_results.csv: Data on municipalities in experimental sample, augmented with electoral results. Source: the present research project and Brazil, Tribunal Superior Eleitoral, "Repositório de Dados Eleitorais," http://www.tse.jus.br/eleicoes/estatisticas/repositorio-de-dados-eleitorais-1/repositorio-de-dados-eleitorais.
- ana.RData: Results of the ANA exam used to construct ANA ranking. 
- pe_munis.RData: includes municipal-level political and educational covariates for experimental sample. 